package com.woniuxy.intellihome.service.impl;

import com.woniuxy.intellihome.entity.Admin;
import com.woniuxy.intellihome.mapper.AdminMapper;
import com.woniuxy.intellihome.service.AdminService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类。。
 * </p>
 *
 * @author jobob
 * @since 2021-08-11
 */
@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements AdminService {
    @Autowired
    private AdminMapper adminMapper;
    @Override
    public Admin getByAccount(String account) {
        return adminMapper.getByAccount(account);
    }

    @Override
    public List<Admin> getAll() {
        return adminMapper.getAll();
    }

    /**
     * 修改管理员的状态为n表示删除该管理员.
     * @param status
     * @param id
     */
   /* @Override
    public void delById(String status, int id) {
        adminMapper.delById(status,id);
    }*/
    @Override
    public void delById(int id){
        adminMapper.delById(id);
    }

    @Override
    public void addAdmin(String account, String password,String status) {
        adminMapper.addAdmin(account,password,status);
    }

    @Override
    public Admin getByAccountAndStatus(String account, String status) {
        return adminMapper.getByAccountAndStatus(account,status);
    }
}
